package org.sgs.toolbox.config;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.List;

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;

public class ApplicationProperties {

	private static PropertiesConfiguration propsConfig;
	static {
		try {
			propsConfig = new PropertiesConfiguration("environment.properties");
		} catch (ConfigurationException e) {
			throw new RuntimeException(e);
		}
	}

	public static BigDecimal getBigDecimal(String arg0, BigDecimal arg1) {
		return propsConfig.getBigDecimal(arg0, arg1);
	}

	public static BigDecimal getBigDecimal(String key) {
		return propsConfig.getBigDecimal(key);
	}

	public static BigInteger getBigInteger(String arg0, BigInteger arg1) {
		return propsConfig.getBigInteger(arg0, arg1);
	}

	public static BigInteger getBigInteger(String key) {
		return propsConfig.getBigInteger(key);
	}

	public static boolean getBoolean(String key, boolean defaultValue) {
		return propsConfig.getBoolean(key, defaultValue);
	}

	public static Boolean getBoolean(String arg0, Boolean arg1) {
		return propsConfig.getBoolean(arg0, arg1);
	}

	public static boolean getBoolean(String key) {
		return propsConfig.getBoolean(key);
	}

	public static byte getByte(String key, byte defaultValue) {
		return propsConfig.getByte(key, defaultValue);
	}

	public static Byte getByte(String arg0, Byte arg1) {
		return propsConfig.getByte(arg0, arg1);
	}

	public static byte getByte(String key) {
		return propsConfig.getByte(key);
	}

	public static double getDouble(String key, double defaultValue) {
		return propsConfig.getDouble(key, defaultValue);
	}

	public static Double getDouble(String arg0, Double arg1) {
		return propsConfig.getDouble(arg0, arg1);
	}

	public static double getDouble(String key) {
		return propsConfig.getDouble(key);
	}

	public static float getFloat(String key, float defaultValue) {
		return propsConfig.getFloat(key, defaultValue);
	}

	public static Float getFloat(String arg0, Float arg1) {
		return propsConfig.getFloat(arg0, arg1);
	}

	public static float getFloat(String key) {
		return propsConfig.getFloat(key);
	}

	public static int getInt(String key, int defaultValue) {
		return propsConfig.getInt(key, defaultValue);
	}

	public static int getInt(String key) {
		return propsConfig.getInt(key);
	}

	public static Integer getInteger(String arg0, Integer arg1) {
		return propsConfig.getInteger(arg0, arg1);
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static List getList(String arg0, List arg1) {
		return propsConfig.getList(arg0, arg1);
	}

	@SuppressWarnings("rawtypes")
	public static List getList(String key) {
		return propsConfig.getList(key);
	}

	public static long getLong(String key, long defaultValue) {
		return propsConfig.getLong(key, defaultValue);
	}

	public static Long getLong(String arg0, Long arg1) {
		return propsConfig.getLong(arg0, arg1);
	}

	public static long getLong(String key) {
		return propsConfig.getLong(key);
	}

	public static short getShort(String key, short defaultValue) {
		return propsConfig.getShort(key, defaultValue);
	}

	public static Short getShort(String arg0, Short arg1) {
		return propsConfig.getShort(arg0, arg1);
	}

	public static short getShort(String key) {
		return propsConfig.getShort(key);
	}

	public static String getString(String key, String defaultValue) {
		return propsConfig.getString(key, defaultValue);
	}

	public static String getString(String key) {
		return propsConfig.getString(key);
	}

	public static String[] getStringArray(String arg0) {
		return propsConfig.getStringArray(arg0);
	}
	
	public static void load(String filePath){
		try {
			propsConfig.load(filePath);
		} catch (ConfigurationException e) {
			throw new RuntimeException(e);
		}
	}
	
}
